package com.gg.web.backend;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;

import com.gg.core.BaseAction;
import com.gg.dao.AboutMeDao;
import com.gg.entity.AboutMe;


public class AboutMeAction extends BaseAction {

	@Autowired
	private AboutMeDao aboutMeDao;

	private AboutMe aboutMe;

	@Action(value = "about_me", results = { @Result(name = "success", location = "/backend/about_me.jsp") })
	public String edit() {
		this.aboutMe = aboutMeDao.get();
		// System.out.println(this.aboutMe.getContent().getValue());
		return "success";
	}

	@Action(value = "about_me_update", results = { @Result(name = "success", location = "about_me.action", type = "redirect") })
	public String update() {
		aboutMeDao.saveOrUpdate(this.aboutMe);
		// System.out.println(this.aboutMe.getContent().getValue());
		return NONE;
	}

	public AboutMe getAboutMe() {
		return aboutMe;
	}

	public void setAboutMe(AboutMe aboutMe) {
		this.aboutMe = aboutMe;
	}

}
